package game;

import java.awt.CheckboxMenuItem;
import java.util.ArrayList;
import java.awt.MenuItem;

public class MenuItemGroup{
	private ArrayList<MenuItem> items = new ArrayList<MenuItem>();
    private CheckboxMenuItem selected = null;

    public MenuItemGroup() {
        super();
    }

    public void addItem(CheckboxMenuItem item) {
        if (items.size() == 0) {
            selected = item;
            item.setState(true);
        }
        else {
            item.setState(false);
        }
        items.add(item);
    }

    public void selectItem(CheckboxMenuItem item) {
    	if(!items.contains(item)){
    		return;
    	}
        selected.setState(false);
        item.setState(true);
        selected = item;
    }

    public MenuItem selectedItem() {
        return selected;
    }
}